package com.japps.turmadochaves;

import java.util.ArrayList;
import com.japps.turmadochaves.adapter.ExpandableAdapter;
import com.japps.turmadochaves.classes.Personagem;
import android.app.ExpandableListActivity;
import android.content.res.Resources;
import android.os.Bundle;

public class AppExpandableList extends ExpandableListActivity {
	
	private ExpandableAdapter adapter;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.applist);

		adapter = new ExpandableAdapter(this, new ArrayList<String>(),
				new ArrayList<ArrayList<Personagem>>());
		
		LoadAdapter();		
		
		setListAdapter(adapter);
	}	
	
/*	@Override
	public boolean onChildClick(ExpandableListView parent, View v,
			int groupPosition, int childPosition, long id) {	
		
		Toast.makeText(getBaseContext(), "G = " + groupPosition + "C = " + childPosition, 10000).show();
		
		return super.onChildClick(parent, v, groupPosition, childPosition, id);
	}*/



	private void LoadAdapter() {
		Resources res = getResources();	
		int id = 1;
		for (String som : res.getStringArray(R.array.chaves)) {				
			Personagem chaves = new Personagem("Chaves", som, "chaves_" + id++);			
			adapter.addItem(chaves);			
		}
	}
}
